<?php
//including header.php 
include '../../include/header.php';
//including page.php (It is a class which contain functions)
include '../../libraries/page.php';
//created object for page.php
$page = new page();
session_start();
$userid = $_SESSION['userid'];

date_default_timezone_set('Asia/Calcutta');
$date1 = date("Y-m-d H:i:s");

//checking the session
if (!$_SESSION['username']) {
    header("location:../user/login.php");
}

if ($_GET['q'] == 'logout') {
    $page->user_logout();
    header("location:../user/login.php");
}

if ($_SERVER["REQUEST_METHOD"] == "POST") {

    $result = $page->mysql_insert_array("customers", $_POST, "submit");
    if ($result) {
        $msg = $message[1];
    } else {
        $msg = $message[0];
    }
}
$customers = 'active';
include '../../include/navbar.php';
?>

<div class="bread_crumb" style="margin-left: 2%">
    &laquo;  <a href="customers">Back</a>
  </div>

<!----------------------------------Display the result message of Addition--------------------->
<div  align="center"><? echo $msg; ?></div>
<!----------------------------------------------div for placing form here------------------------->
<div  style="margin-left: auto;margin-right: auto; width:290px;margin-top:5%;">
    <h3 style="color:#777;margin-left: 25%;"> Add Customer</h3>
    <br />

    <!---------------------------------form------------------------------------------------>
    <form method="POST"  action="">
        <label>Customer</label>
        <input class="input-xlarge" id="focusedInput" type="text" name="customer" placeholder="Enter name..."  required>
          <label>Address</label>
          <input class="input-xlarge" name="address" type="text"  placeholder="Enter Address...">
           <label>Contact name</label>
          <input class="input-xlarge" name="contactname" type="text"  placeholder="Enter Address...">
          <label>Phone</label>
          <input class="input-xlarge"  type="tel" name="phone"  placeholder="Enter Phone no..">
          <label>Tin</label>
          <input class="input-xlarge"  type="text" name="tin"  placeholder="Enter Tin...">
        <button class="btn btn-inverse" type="submit"  name="submit" style="float:right; margin-right: 15px; margin-top: 20px;">Add</button 
    </form>
</div>

<?php
//including footer.php
include '../../include/footer.php';
?>